﻿using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SCM.API.Write.Application.Command.SaleRefund;
using SCM.ErrorCode;

namespace SCM.API.Write.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    
    public class SaleRefundController : ControllerBase
    {
        IMediator mediator;

        public SaleRefundController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpPost]
        public async Task<APIResult<int>> AddSaleRefund(AddSaleRefundCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpPut]
        public Task<APIResult<int>> UpdateSaleRefund(UpdateSaleRefundCommand request)
        {
            return mediator.Send(request);
        }
        [HttpPut]
        public Task<APIResult<int>> DelSaleRefund(DelSaleRefundCommand request)
        {
            return mediator.Send(request);
        }
    }
}
